#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
int main()
{
  printf("I am runing...\n");
  pid_t id = fork();
  if(id == 0)//子进程
  {
    while(1)
    {
      printf("I'm child, ppid:%d, pid:%d\n",getppid(),getpid());
      sleep(1);
    }
  }
  else if(id > 0)
  {
    while(1)
    {
      printf("I'm parent, ppid:%d, pid:%d\n",getppid(),getpid());
      sleep(1);
    }
  }
  else 
  {
    //fork error 
    exit(1);
  }
  return 0;
}
